package com.ha.auto_skip;

import com.ha.auto_skip.bean.JumpListBean;
import com.xinkao.skmvp.base.BaseApplication;
import com.xinkao.skmvp.base.BaseBean;
import com.xinkao.skmvp.utils.Log2f;
import com.xinkao.skmvp.utils.MMKVUtils;

public class App extends BaseApplication {

    /**
     * 启动状态
     */
    public static JumpListBean mJumpListBean;
    public static JumpListBean getJumpListBean() {
        if (mJumpListBean == null) {
            mJumpListBean = BaseBean.loadBean(JumpListBean.class);
            if (mJumpListBean == null) {
                mJumpListBean = new JumpListBean();
            }
        }
        return mJumpListBean;
    }


    private static Long clickDuration = null;
    /**
     * 获取点击时长
     * @return 点击时长
     */
    public static long getClickDuration() {
        if (clickDuration == null) {
            clickDuration = Long.parseLong(MMKVUtils.getInstance().getString("click_duration", "20"));
        }

        return clickDuration;
    }

    public static void setClickDuration(Long clickDuration) {
        App.clickDuration = clickDuration;
        MMKVUtils.getInstance().saveString("click_duration", String.valueOf(clickDuration));
    }

    @Override
    public void initConfig() {
        // 日志写入文件
        Log2f.LOG_FILE = !isDebug();
    }

    @Override
    public boolean isDebug() {
        return BuildConfig.DEBUG;
    }
}
